package com.yrx.merch.server;


import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/yrx")
public class MerchAdd {



    @PostMapping("add-mecher")
    public JSONObject addMerch(@RequestBody RequestBody1 requestBody) {

        System.out.println(requestBody.getName()+"####"+requestBody.getAge());
        JSONObject js = new JSONObject();

        List<RequestBody1> list= new ArrayList<RequestBody1>();
        for (int i=0;i<5;i++){
            RequestBody1 requestBody1 = new RequestBody1();
            requestBody1.setAge("年龄"+i);
            requestBody1.setName("姓名"+i);
            list.add(requestBody1);
        }

        js.put("resdata",list);
        js.put("size",list.size());
        return js;
    }
}
